package com.wing.sell.model.entity;

import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.wing.mybatis.common.BaseEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 销售订单产品评审表
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("sel_order_pro_review")
public class OrderProReview extends BaseEntity<OrderProReview> implements Serializable {

    private static final long serialVersionUID = 1L;

    public enum Status implements IEnum<Integer> {

        /**
        * 待评审
        */
        pending(0,"待评审"),
        /**
        * 已评审
        */
        accepted(1,"已评审"),

        linking(2,"待关联"),

        linked(3,"已关联");

        private int code;
        private String desc;

        Status(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    public enum Result implements IEnum<Integer> {

        /**
        * 评审不通过
        */
        refuse(0,"评审不通过"),
        /**
        * 评审通过
        */
        pass(1,"评审通过");

        private int code;
        private String desc;

        Result(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;


    @TableField(exist = false)
    private Long cusProductId;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * 订单ID
     */
    private Long orderId;

    /**
     * 订单产品表ID
     */
    private Long proId;

    /**
     * 评审环节ID
     */
    private Long reviewProcessId;
    /**
     * 评审环节名称
     */
    @TableField(exist = false)
    private String  reviewProcessName;

    /**
     * 评审人ID
     */
    private Long reviewerId;
    /**
     * 评审岗位ID
     */
    private Long reviewPostId;

    /**
     * 客户记录表主键
     */
    private Long reviewCatalogId;

    /**
     * 评审人名称
     */
    private String reviewerName;
    /**
     * 评审岗位名称
     */
    private String reviewPostName;

    /**
     * 评审结果描述
     */
    private String reviewDesc;

    /**
     * 状态
     */
    private Status status;

    /**
    * 状态描述
    */
    @TableField(exist = false)
    private String statusDesc;

    public String getStatusDesc() {
        return status == null ? null : status.getDesc();
    }

    /**
     * 评审结果
     */
    private Result result;

    /**
    * 评审结果描述
    */
    @TableField(exist = false)
    private String resultDesc;

    public String getResultDesc() {
        return result == null ? null : result.getDesc();
    }

    /**
    * 评审截止时间
    */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime reviewEndTime;

    /**
     * 评审完成时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime reviewOkTime;

    /**
     * 评审用时
     */
    private String reviewTime;

    /**
     * 评审任务编号
     */
    private String code;

    /**
     * 评审任务编号用(yyyyMMdd)
     */
    private Integer day;

    /**
     * 评审任务编号用
     */
    private Integer no;

}
